<template>
  <div>
    <el-row>
      <el-col :span="24"><div class="grid-content bg-purple-dark">
        User {{ $route.params.code }}
        Name {{ $route.params.name }}
        Data {{ data }}
        <el-button type="primary">主要按钮</el-button>
        <el-button type="success">成功按钮</el-button>
      </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import axios from '@/request'
import {getString, aa} from '@/api/demo'

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "User",
  data() {
    return {
      data: ""
    }
  },
  created() {
    //this.demoApi();
    //this.getStringApi();
    this.aaApi();
  },
  methods: {
    //原始写法
    demoApi() {
      let that = this;
      axios({
        method: 'get',
        url: '/system/aa',
        data: {}
      }).then(function (response) {
        that.data = response.data;
      });
    },
    //最优写法,把api提出来
    getStringApi() {
      getString().then(function (response) {
        this.data = response;
      })
    },
    aaApi() {
      let that = this;
      aa().then(function (response) {
        that.data = response.data;
      })
    }
  },

}
</script>

<style scoped>

</style>